package com.class05._super;

/**
 * @ClassDescription:
 * @JdkVersion: 17
 * @Author: yxy
 * @Created: 2024/4/8 16:59
 */
public class Student extends Person {
    String school;
    int id = 1002;//学号

    public void study() {
        System.out.println("好好学习");
    }
    @Override
    public void eat(double money) {
        System.out.println("学生吃了" + money + "钱的饭");
    }
    @Override
    public void sleep() {
        System.out.println("学生保证每天不低于8小时的睡眠");
    }

    //    测试super调用方法、属性
    public void show() {
        eat(10);//省略了this
        this.eat(10);
        super.eat(14);
    }
    public void show1() {
        doSport();
        this.doSport();
    }
    public void show2() {
        System.out.println(id);//1002
        System.out.println(this.id);//1002
        System.out.println(super.id);//1001
    }

    public void show3() {

        System.out.println(name);
        System.out.println(this.name);
        System.out.println(super.name);
    }

//    测试super调用父类构造器
    public Student() {
        super();
//        this("Tom",12);
        System.out.println("无参构造器");

    }
    public Student(String name, int age) {
//        setAge(age);
//        super.name = name;
        super(name,age);
    }




}
